package cn.hh.ymcc.feign;


import cn.hh.ymcc.enums.GlobalExceptionCode;
import cn.hh.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class MediaFallbackFactory implements FallbackFactory<MediaFeignClient> {


    @Override
    public MediaFeignClient create(Throwable throwable) {
        return new MediaFeignClient() {
            @Override
            public JSONResult queryMediaByCourseId(Long courseId) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR.getMessage());
            }

            @Override
            public JSONResult get(Long id) {
                return JSONResult.error(GlobalExceptionCode.SERVICE_ERROR.getMessage());
            }
        };



    }
}
